<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>信用额度使用详情</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox">
                <div class="label">额度变化类型</div>
                <div class="field">
                    <select name="limTypCd" id="limTypCd">
                        <option value=" " seleted>请选择</option>
                        <c:forEach items="${limTypCdList }" var="limTypCd">
                        	<option value="${limTypCd.key }">${limTypCd.value }</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            
            <div class="clearFix"></div>
            <div class="btnsBox">
                <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
                <!-- <span id="addBtn" class="sq-button sq-button-round">新增</span>
                <span id="changeBtn" class="sq-button sq-button-round">修改</span>
                <span id="reSetPwdBtn" class="sq-button sq-button-round">密码重置</span> -->
            </div>
        </div>
    </form>
</div>
<div id="ligergrid" class="sq-grid"></div>
</div>

<script type="text/javascript">
var grid = null;
var id = '${id}';
$(function () {	
	initData();
    $("#searchBar").ligerForm({
    });
    $("#searchBtn").click(function(event) {
         var form = liger.get("searchBar");
         var data = form.getData();
         //alert(JSON.stringify(data));
         for (name in data){
            grid.setParm(name, $.trim(data[name]));
         };
        grid.reload();
    });
});

function initData(){
	grid =  $("#ligergrid").ligerGrid({
    	url: '<%=path%>/brcrlit/prjBrCrLimRec/initList.do?limId='+id,
    	method : 'get',
        columns: [
            { display: '项目名称', name: 'prjNm', minWidth: 140,
            	render: function (rowdata, rowindex, value, column) { 
            		var h = '';
            			if(value&&value!="null"){
            		    h+='<a href="javascript:prjDetail(';
                        h+="'"+rowdata.prjId+"'";
                        h+=')">'+value+'</a>'
            			}
                        return h;
            		},enabledSort:true},
            { display: '支付表号', name: 'paySchNo', minWidth: 140,
            			render: function (rowdata, rowindex, value, column) { 
    	            		var h = '';
    	            		    h='<a href="javascript:payDetail(';
    	                        h+="'"+rowdata.prjPrdDtlId+"',";
    	                        h+="'"+rowdata.paySchId+"',";
    	                        h+="'"+rowdata.prjPrdId+"',";
    	                        h+="'"+rowdata.prjId+"'";
    	                        h+=')">'+value+'</a>'
    	                        return h;
    	            		},enabledSort:true },
            { display: '额度变化类型', name: 'limTypCdNm', minWidth: 140 , enabledSort:true},
            { display: '使用额度', name: 'limOpAmt', minWidth: 140 ,
            	render: function (rowdata, rowindex, value, column) { 
            		var h = (value/100).toFixed(2);
                        return h+" 元";
            		},enabledSort:true},
            { display: '创建时间', name: 'crtTm', minWidth: 140 , render:renderDate, enabledSort:true}
        ],
        pageSize:10,
        root:'rows',
        record:'total',
        hideLoadButton : true,
        width: '100%',
        isScroll: false,
        checkbox:false,
        rownumbers:true,
    });
}

//格式化时间
function renderDate(rowdata, index, value){
	var dateStr = "";
	if(null != value){
		var date = new Date(value);
		dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
	}
	return dateStr;
}

function clearBtn(){
    $("#searchBar").ligerForm();
			var form = new liger.get("searchBar");
			form.setData({
				limTypCd:" "
			 });
	}
	
function prjDetail(prjId){
	var fromPrjFlag = true;
	var detailFlag = true;
	Add_navTab('tab_project_detail'+prjId,'项目详情','<%=path%>/project/prjbscinfo/toModifyPage.do?fromPrjFlag='+fromPrjFlag+'&&id='+prjId+'&&detailFlag='+detailFlag);
}

function payDetail(prjPrdDtlId,paySchId,prjPrdId,prjId){
	var detailFlag = true;
	Add_navTab('tab_prj_quat_prps'+paySchId,'查看支付表','<%=path%>/project/prjprdpayschm/toAddPage.do?prjId='+prjId+'&&id='+paySchId+'&&prjPrdDtlId='+prjPrdDtlId+'&&prjPrdId='+prjPrdId+'&&detailFlag='+detailFlag);
}

</script>
</body>
</html>
